/**
 * 
 */
package org.pump.client.codec;

import java.util.Arrays;

import org.apache.mina.core.buffer.IoBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author liudong03
 *
 */
public class FormatDescriptionPack extends EventData{
	private static final Logger mylog = LoggerFactory
			.getLogger(FormatDescriptionPack.class);
	int binlog_version;
	byte[] server_version = new byte[50];
	long create_timestamp;
	byte header_length;
	byte[] data = new byte[26];
	
	public static FormatDescriptionPack readBuffer(IoBuffer in,int len)
	{
		if(in.remaining() < len)
		{
			return null;
		}
		FormatDescriptionPack formatpack = new FormatDescriptionPack();
		formatpack.binlog_version = in.getUnsignedShort();
		in.get(formatpack.server_version);
		formatpack.create_timestamp = in.getUnsignedInt();
		formatpack.header_length = in.get();
		in.get(formatpack.data);
		
		return formatpack;
	}
	/**
	 * 
	 */
	public FormatDescriptionPack() {
		// TODO Auto-generated constructor stub
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "FormatDescriptionPack [binlog_version="
				+ binlog_version + ", server_version="
				+ Arrays.toString(server_version) + ", create_timestamp="
				+ create_timestamp + ", header_length=" + header_length
				+ ", data=" + Arrays.toString(data) + "]";
	}
	
	
	
	
}
